
             
/**
 * 
 *
 * @File name:  BatchDeleteTPersonnalAction.java   批量删除【人员信息:T_PERSONNAL】
 * @Create on:  2011-10-30 23:38:953
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.estates.staff.action;

            
import java.sql.Connection;
import java.util.Date;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.po.POUtils;
import cn.boho.framework.service.MessageService;

import com.boho.common.Constant;
import com.boho.common.SystemUtils;
import com.boho.estates.po.TPersonnalPO;
            
        

public class BatchDeleteTPersonnalAction extends ActionImp {
	private Object[] personnalNo;
	private Connection con=null;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if (!(ex instanceof UserOperationException)) {
			atx.setErrorContext("BOHO_COMMON_1003", MessageService.getMessage("BOHO_COMMON_1003"),"【人员信息】", ex);
		}
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		if(personnalNo!=null){
			String updateBy = SystemUtils.getSessionUser(atx);
			Date updateDate = new Date();
			for (int i = 0; i < personnalNo.length; i++) {
				TPersonnalPO conditionPersonnalPO = new TPersonnalPO();
				TPersonnalPO vaulePersonnalPO = new TPersonnalPO();
				conditionPersonnalPO.setPersonnalNo(personnalNo[i]==null||personnalNo[i].toString().trim().equals("")?-1:new Integer((String)personnalNo[i]));
				vaulePersonnalPO.setIsValid(Constant.IS_VALID_FALSE);
				vaulePersonnalPO.setUpdateBy(updateBy);
				vaulePersonnalPO.setUpdateDate(updateDate);
				POUtils.update(con, conditionPersonnalPO, vaulePersonnalPO, false);
				logger.info("删除操作：" + updateBy + "@"+ new Date(System.currentTimeMillis())+ "删除表：【人员信息:T_PERSONNAL】 主键【"+ personnalNo[i] + "】");
			}
		}
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		personnalNo = atx.getArrayValue("PERSONNAL_NO");
		return 1;
	}
}
